package com.test.shiro.factory;

import java.util.LinkedHashMap;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/9/22 12:00
 */
public class FilterChainDefinationMapBuilder {
    public LinkedHashMap<String, String> buildFilterChainDefinationMapBuilder() {
        LinkedHashMap<String, String> map = new LinkedHashMap<>();
        // 从数据库里面获取过滤条件
        // 注意过滤条件匹配是需要顺序的
        map.put("/login.jsp", "anon");
        map.put("/shiro/login", "anon");
        map.put("/shiro/logout", "anon");

        map.put("/user.jsp", "authc,roles[user]");
        map.put("/admin.jsp", "authc,roles[admin]");

        map.put("/list.jsp", "user");

        map.put("/**", "authc");
        return map;
    }
}
